<!DOCTYPE html>

<html>
<head>
  <title>link.coffee</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" media="all" href="public/stylesheets/normalize.css" />
  <link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
  <div class="container">
    <div class="page">

      <div class="header">
        
          <h1>link.coffee</h1>
        

        
          <div class="toc">
            <h3>Table of Contents</h3>
            <ol>
              
                
                <li>
                  <a class="source" href="admin.html">
                    admin.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.auditData.html">
                    api.auditData.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.auditEvent.html">
                    api.auditEvent.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.html">
                    api.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.entity.html">
                    api.entity.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.map.html">
                    api.map.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.server.html">
                    api.server.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.variable.html">
                    api.variable.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="api.view.html">
                    api.view.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="app.instance.html">
                    app.instance.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="appjs.html">
                    appjs.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="data.html">
                    data.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="dataUtil.html">
                    dataUtil.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="manager.html">
                    manager.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="messages.html">
                    messages.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="auditData.html">
                    auditData.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="auditEvent.html">
                    auditEvent.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="base.html">
                    base.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="entityDefinition.html">
                    entityDefinition.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="entityObject.html">
                    entityObject.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="eventAction.html">
                    eventAction.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="eventRule.html">
                    eventRule.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="link.html">
                    link.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="map.html">
                    map.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="shape.html">
                    shape.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="user.html">
                    user.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="userSettings.html">
                    userSettings.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="variable.html">
                    variable.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="adminRoutes.html">
                    adminRoutes.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="appRoutes.html">
                    appRoutes.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="settings.html">
                    settings.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="sockets.html">
                    sockets.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="tutorial.html">
                    tutorial.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="vectors.html">
                    vectors.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="statusTabView.html">
                    statusTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="toolsTabView.html">
                    toolsTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="usersTabView.html">
                    usersTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="adminView.html">
                    adminView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="alertView.html">
                    alertView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="auditDataManagerView.html">
                    auditDataManagerView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="auditEventManagerView.html">
                    auditEventManagerView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="baseView.html">
                    baseView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="createMapView.html">
                    createMapView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="entityManagerView.html">
                    entityManagerView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="footerView.html">
                    footerView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="helpView.html">
                    helpView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="entitiesTabView.html">
                    entitiesTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="inspectorTabView.html">
                    inspectorTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="mapTabView.html">
                    mapTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="shapeTabView.html">
                    shapeTabView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="controlsView.html">
                    controlsView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="labelEditView.html">
                    labelEditView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="linkCreatorView.html">
                    linkCreatorView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="linkLabelsView.html">
                    linkLabelsView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="linkView.html">
                    linkView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="shapeLabelsView.html">
                    shapeLabelsView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="shapeView.html">
                    shapeView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="shapesMoverView.html">
                    shapesMoverView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="mapView.html">
                    mapView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="menuView.html">
                    menuView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="overlayView.html">
                    overlayView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="scriptEditorView.html">
                    scriptEditorView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="settingsView.html">
                    settingsView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="startView.html">
                    startView.coffee
                  </a>
                </li>
              
                
                <li>
                  <a class="source" href="variableManagerView.html">
                    variableManagerView.coffee
                  </a>
                </li>
              
            </ol>
          </div>
        
      </div>

      
        
        <h2 id="link-model">LINK MODEL</h2>

        
      
        
        <p>Represents a link (connection) between two shapes on the map.
Extends <a href="shape.html">Shape</a>.</p>

        
          <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">SystemApp</span>.<span class="title">Link</span> <span class="keyword">extends</span> <span class="title">SystemApp</span>.<span class="title">BaseModel</span></span>
    <span class="attribute">typeName</span>: <span class="string">"Link"</span>
    <span class="attribute">defaults</span>:
        <span class="attribute">arrowSource</span>: SystemApp.Settings.link.arrowSource
        <span class="attribute">arrowTarget</span>: SystemApp.Settings.link.arrowTarget
        <span class="attribute">fontSize</span>: SystemApp.Settings.link.fontSize
        <span class="attribute">foreground</span>: SystemApp.Settings.link.foreground
        <span class="attribute">labelOpacity</span>: SystemApp.Settings.link.labelOpacity
        <span class="attribute">opacity</span>: SystemApp.Settings.link.opacity
        <span class="attribute">smooth</span>: SystemApp.Settings.link.smooth
        <span class="attribute">stroke</span>: SystemApp.Settings.link.stroke
        <span class="attribute">strokeWidth</span>: SystemApp.Settings.link.strokeWidth
        <span class="attribute">zIndex</span>: SystemApp.Settings.link.zIndex</pre></div>
        
      
        
        <h2 id="sync">SYNC</h2>

        
      
        
        <p>Override the &quot;save&quot; method as we don&#39;t need to sync individual links with the server.</p>

        
          <div class='highlight'><pre>    <span class="attribute">save</span>: <span class="function"><span class="params">(key, value, options)</span> =&gt;</span> <span class="property">@noSyncSave</span> key, value, options</pre></div>
        
      
        
        <p>Override the &quot;destroy&quot; method as we don&#39;t need to sync individual links with the server.</p>

        
          <div class='highlight'><pre>    <span class="attribute">destroy</span>: <span class="function"><span class="params">(options)</span> =&gt;</span> <span class="property">@noSyncDestroy</span> options</pre></div>
        
      
        
        <h2 id="main-properties">MAIN PROPERTIES</h2>

        
      
        
        <p>Helper to set / get the link&#39;s arrow source (0, 1 or 2).</p>

        
          <div class='highlight'><pre>    <span class="attribute">arrowSource</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"arrowSource"</span>, value
        <span class="property">@get</span> <span class="string">"arrowSource"</span></pre></div>
        
      
        
        <p>Helper to set / get the link&#39;s arrow target (0, 1 or 2).</p>

        
          <div class='highlight'><pre>    <span class="attribute">arrowTarget</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"arrowTarget"</span>, value
        <span class="property">@get</span> <span class="string">"arrowTarget"</span></pre></div>
        
      
        
        <p>Helper to set / get the link&#39;s font size.</p>

        
          <div class='highlight'><pre>    <span class="attribute">fontSize</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"fontSize"</span>, value
        <span class="property">@get</span> <span class="string">"fontSize"</span></pre></div>
        
      
        
        <p>Helper to set / get the link&#39;s label stroke.</p>

        
          <div class='highlight'><pre>    <span class="attribute">foreground</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"foreground"</span>, value
        <span class="property">@get</span> <span class="string">"foreground"</span></pre></div>
        
      
        
        <p>Helper to set / get the link&#39;s label opacity.</p>

        
          <div class='highlight'><pre>    <span class="attribute">labelOpacity</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"labelOpacity"</span>, value
        <span class="property">@get</span> <span class="string">"labelOpacity"</span></pre></div>
        
      
        
        <p>Helper to set / get the link opacity.</p>

        
          <div class='highlight'><pre>    <span class="attribute">opacity</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"opacity"</span>, value
        <span class="property">@get</span> <span class="string">"opacity"</span></pre></div>
        
      
        
        <p>Helper to set / get the link smooth (true or false).</p>

        
          <div class='highlight'><pre>    <span class="attribute">smooth</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"smooth"</span>, value
        <span class="property">@get</span> <span class="string">"smooth"</span></pre></div>
        
      
        
        <p>Helper to set / get the link stroke or border color.</p>

        
          <div class='highlight'><pre>    <span class="attribute">stroke</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"stroke"</span>, value
        <span class="property">@get</span> <span class="string">"stroke"</span></pre></div>
        
      
        
        <p>Helper to set / get the link stroke width.</p>

        
          <div class='highlight'><pre>    <span class="attribute">strokeWidth</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"strokeWidth"</span>, value
        <span class="property">@get</span> <span class="string">"strokeWidth"</span></pre></div>
        
      
        
        <p>Helper to get / set the link z-index value.</p>

        
          <div class='highlight'><pre>    <span class="attribute">zIndex</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"zIndex"</span>, value
        <span class="property">@get</span> <span class="string">"zIndex"</span></pre></div>
        
      
        
        <h2 id="label-properties">LABEL PROPERTIES</h2>

        
      
        
        <p>Helper to get the shape&#39;s default text.</p>

        
          <div class='highlight'><pre>    <span class="attribute">defaultText</span>:<span class="function"> =&gt;</span>
        <span class="property">@id</span></pre></div>
        
      
        
        <p>Helper to get / set the link text at the start of the link path.</p>

        
          <div class='highlight'><pre>    <span class="attribute">textStart</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"textStart"</span>, value
        <span class="property">@get</span> <span class="string">"textStart"</span></pre></div>
        
      
        
        <p>Helper to get / set the link text at the middle of the link path.</p>

        
          <div class='highlight'><pre>    <span class="attribute">textMiddle</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"textMiddle"</span>, value
        <span class="property">@get</span> <span class="string">"textMiddle"</span></pre></div>
        
      
        
        <p>Helper to get / set the link text at the end of the link path.</p>

        
          <div class='highlight'><pre>    <span class="attribute">textEnd</span>: <span class="function"><span class="params">(value)</span> =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"textEnd"</span>, value
        <span class="property">@get</span> <span class="string">"textEnd"</span></pre></div>
        
      
        
        <h2 id="source-target-properties">SOURCE / TARGET PROPERTIES</h2>

        
      
        
        <p>Helper to set / get the source <a href="shape.html">Shape</a> id.</p>

        
          <div class='highlight'><pre>    <span class="attribute">sourceId</span>: <span class="function"><span class="params">(value)</span>  =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"sourceId"</span>, value
        <span class="property">@get</span> <span class="string">"sourceId"</span></pre></div>
        
      
        
        <p>Helper to set / get the target <a href="shape.html">Shape</a> id.</p>

        
          <div class='highlight'><pre>    <span class="attribute">targetId</span>: <span class="function"><span class="params">(value)</span>  =&gt;</span>
        <span class="keyword">if</span> value?
            <span class="property">@set</span> <span class="string">"targetId"</span>, value
        <span class="property">@get</span> <span class="string">"targetId"</span></pre></div>
        
      
        
        <h2 id="link-collection">LINK COLLECTION</h2>

        
      
        
        <p>Represents a collection of links.</p>

        
          <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">SystemApp</span>.<span class="title">LinkCollection</span> <span class="keyword">extends</span> <span class="title">SystemApp</span>.<span class="title">BaseCollection</span></span>
    <span class="attribute">typeName</span>: <span class="string">"LinkCollection"</span>
    <span class="attribute">model</span>: SystemApp.Link</pre></div>
        
      
        
        <p>Override the default &quot;create&quot; method, as we don&#39;t need to sync
Shape models directly with the server.</p>

        
          <div class='highlight'><pre>    <span class="attribute">create</span>: <span class="function"><span class="params">(model, options)</span> =&gt;</span> <span class="property">@noSyncCreate</span> model, options</pre></div>
        
      
        
        <p>Set the comparator function to order the links collection by z-index.</p>

        
          <div class='highlight'><pre>    <span class="attribute">comparator</span>: <span class="function"><span class="params">(link)</span> -&gt;</span> <span class="keyword">return</span> link.zIndex()</pre></div>
        
      
      <div class="fleur">h</div>
    </div>
  </div>
</body>
</html>
